#define _CRT_SECURE_NO_WARNINGS 1


#include<stdio.h>

void InsertSort(int* array, int n)
{
	for (int  i = 0; i < n - 1; i++)
	{
		int end = i;
		int tmp = array[end + 1];
		while (end >= 0)
		{
			if (array[end] > tmp)
			{
				array[end + 1] = array[end];
				end--;
			}
			else
			{
				break;
			}
			array[end + 1] = tmp;
		}
	}
}
int main()
{
	int array[] = { 9,6,3,8,5,2,7,4,1 };
	int size = sizeof(array) / sizeof(array[0]);
	InsertSort(array, size);
	return 0;
}